package com.evil.common.core.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FindByStringReqDTO {

    /**
     * string
     */
    @NotBlank(message = "string cant not empty")
    private String string;

    /**
     * 是否过滤已删除
     */
    @NotNull(message = "filterDeleted cant not null")
    private Boolean filterDeleted;

    /**
     * 是否会话缓存
     */
    @NotNull(message = "cache cant not null")
    private Boolean cache;

    public static FindByStringReqDTO filter(String string) {
        return new FindByStringReqDTO(string, true, false);
    }

    public static FindByStringReqDTO unFilter(String string) {
        return new FindByStringReqDTO(string, false, false);
    }

    public static FindByStringReqDTO filterCache(String string) {
        return new FindByStringReqDTO(string, true, true);
    }

    public static FindByStringReqDTO unFilterCache(String string) {
        return new FindByStringReqDTO(string, false, true);
    }
}
